package org.aurora.remote.protocol;

import org.aurora.common.serialization.SerializationType;

public abstract class RemoteCommand {
    protected transient RemoteCommandType remoteCommandType;
    protected transient int requestOrdinal;
    protected RemoteHeader header = new RemoteHeader();
    protected transient int version = RemoteCommonConstant.VERSION;
    protected transient int commandCode;
    private transient byte[] data;
    private transient SerializationType serializationType = SerializationType.JSON_UTF8;
    private transient String ip;
    private transient int port;

    public abstract RemoteCommandType getRemoteCommandType();

    public int getRequestOrdinal() {
        return requestOrdinal;
    }

    public void setRequestOrdinal(int requestOrdinal) {
        this.requestOrdinal = requestOrdinal;
    }

    protected void setVersion(int version) {
        this.version = version;
    }

    public <T> T getHeaderData(String key) {
        return this.header.getHeader(key);
    }

    public void setHeaderData(String key, Object val) {
        this.header.putHeader(key, val);
    }

    public int getVersion() {
        return version;
    }

    public int getCommandCode() {
        return commandCode;
    }

    public void setCommandCode(int commandCode) {
        this.commandCode = commandCode;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public SerializationType getSerializationType() {
        return serializationType;
    }

    public void setSerializationType(SerializationType serializationType) {
        this.serializationType = serializationType;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }
}
